<script setup lang="ts">
import type { Item } from '@/App.vue';

const newList = defineProps<{ list: Item[] }>()
</script>
<template>
  <div class="table-container">
    <table class="table">
      <thead>
        <tr>
          <th>ID</th>
          <th>Name</th>
          <th>Age</th>
          <th>Gender</th>
          <th>Action</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="item in list" :key="item.id">
          <td>{{ item.id }}</td>
          <td>{{ item.name }}</td>
          <td>{{ item.age }}</td>
          <td>{{ item.gender }}</td>
          <td>
            <slot name="leftButton" :id="item.id"></slot>
          </td>

        </tr>
      </tbody>
    </table>

  </div>
</template>
<style scoped>
table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid #ddd;
  background-color: #f2f2f2;
}

th {
  background-color: #f2f2f2;
  color: #333;
  font-weight: bold;
}

tr:hover {
  background-color: #ddd;
}

.table-container {
  max-width: 800px;
  margin: 0 auto;
}
</style>